<%@codepage="65001"%>
<%session.codepage="65001"%>
<!-- #include virtual=/inc/dbConn.asp -->
<!-- #include virtual=/inc/function.asp -->
<!-- #include virtual=/inc/action.header.inc.asp -->

<%
	'## 파라미터 변수 선언부
	company		= Request("findCompany")
	major		= Request("findMajor")	
	compCd		= Request("compCd")
	
	SQLTitle = "-- ■■■■ 거래처 정보 콤보 ■■■■"
	
	'## 검색조건에 따른 조건절 만들기 
	If company <> "" Then 
		addSql = " company LIKE '%" & company & "%' "
	End If 
	If major <> "" Then 
		If addSql <> "" Then addSql = addSql & " AND "
		addSql = addSql & " (owner LIKE '%" & major & "%' OR major LIKE '%" & major & "%')"
	End If 
	If addSql <> "" Then 
		addSql = " WHERE flag='Y' AND " & addSql 
	End If 

	If compCd <> "" Then 
		addSql = " WHERE  compCd=" & compCd
	End If 
	SQL = "SELECT compCd, company, phone, major, cellPhone, flag FROM tblCompany " & addSql & " ORDER BY company" 

	If xMode="debug" Then 
		Call showDebug(SQLTitle,SQL) 
	End If 

	Set Rs=Server.CreateObject("ADODB.RecordSet")
	Rs.open SQL, DbCon, 1
	
	Response.write "<Companys>" & vbcrlf

	If Rs.eof Or Rs.bof Then 
	Else 
		Do Until Rs.eof Or Rs.bof
		
			Response.write "	<CompList>" & vbcrlf
				Call mkXMLNode("compCd", rs("compCd"), 2)
				Call mkXMLNode("company", rs("company"), 2)
'				Call mkXMLNode("phone", rs("phone"), 2)
'				Call mkXMLNode("major", rs("major"), 2)
'				Call mkXMLNode("cellPhone", rs("cellPhone"), 2)
'				Call mkXMLNode("flag", Rs("flag"), 2)
			Response.write "	</CompList>" & vbcrlf

		Rs.movenext
		Loop 
	End If
	Response.write "</Companys>" & vbcrlf
'	Call rsWithXML("Save OK!")
%>